package top.healthylife.gateway.platform.softwind.api.api.authorizationcallback;

/**
 * @author : GaoZeXi
 * @date 2021/7/21 14:19
 */


import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.healthylife.gateway.core.service.ParentFace;
import top.healthylife.gateway.dto.annotation.ApiServiceExplain;
import top.healthylife.gateway.platform.softwind.api.util.AESUtils;
import top.healthylife.gateway.platform.softwind.dto.decrypteparams.req.WindReqDecryptParamsDto;
import top.healthylife.gateway.platform.softwind.dto.decrypteparams.res.WindResDecryptParamsDto;

/**
 * @author : GaoZeXi
 * @date 2021/7/14 17:47
 */
@Slf4j
@Service
@ApiServiceExplain( docUrl="https://wfq2020.com/channel-admin/#/login", price = 20, apiName = "参数解密", info = "对授权回调的参数进行解密")
public class WindDecryptParamsApi implements ParentFace<WindReqDecryptParamsDto, WindResDecryptParamsDto> {

    @Override
    public WindResDecryptParamsDto execute(WindReqDecryptParamsDto windReqAuthorizationCallBackDto) {
        log.info("接收到授权请求");
        String message = windReqAuthorizationCallBackDto.getMessage();
        log.info("收到密文参数message:{}",message);
        String decrypt = AESUtils.decryptBase64(message);
        log.info("参数解密后:{}", decrypt);
        return new WindResDecryptParamsDto().setMessage(decrypt);
    }

}
